<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=sc, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
  function foo(name,age){
    console.log("传入的参数",name,age)
    //在函数中都存在一个变量，叫arguments/
    //arguments是一个多想1
    console.log(typeof arguments)
    //对象内部包含了所有传入的参数
    console.log(arguments[0])
    console.log(arguments[1])
    console.log(arguments[2])
    console.log("================")
    //对arguments进行遍历
    for(var i=0;i<arguments.length;i++){
      console.log(arguments[i])
    }
  }
  
  foo("why",18,1.88,"广州市")//所有传入的实参，都放在arguments对象里面
  //2.arguments案例
  function sum(...args){
    var total=0
    for(var i=0;i<arguments.length;i++){
      console.log(arguments[[i]])
      total+=num
    }
    return total
  }
  console.log(10,20)
  console.log(10,20,30)
  console.log(10,20,30,40)
  </script>
</body>
</html>